<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="Generator" content="EditPlus®">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <meta name="renderer" content="webkit">
    <title>填写订单</title>
    <link rel="shortcut icon" type="image/x-icon" th:href="@{/myFile/imgold/icon/favicon.ico}">
    <link rel="stylesheet" type="text/css" th:href="@{/theme/css/base.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/theme/css/home.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <script type="text/javascript" th:src="@{/theme/js/jquery.js}"></script>
    <script type="text/javascript" th:src="@{/layui/layui.all.js}"></script>
    <script type="text/javascript" th:src="@{/theme/js/delCartOnPages.js}"></script>
    <script type="text/javascript" th:src="@{/theme/js/searchToPage.js}"></script>
    <script type="text/javascript">

        function submmitOrder() {
            var allCheckId=$("#allCheckId").val();
            var orderId=$("#orderId").val();
            var address = $(".address");
            var addressId;
            for(var i=0;i<address.length;i++){
                if(address[i].checked){
                    addressId = address[i].id;
                }
            }
            console.log(allCheckId);
            console.log(orderId);
            if(allCheckId!=null&&allCheckId!=''){
                window.location="PayOrder?allCheckCartId="+allCheckId+"&addressId="+addressId;
            }else if(orderId!=null&&orderId!=''){
                window.location="PayOrderaByOrderId?orderId="+orderId+"&addressId="+addressId;
            }

        }
        function addAddress() {
            window.location='myAddressAdd';
        }


        function edit(id) {
            window.location = "myAddressEdit?id=" + id + "";
        }

        function logout() {
            $.ajax({
                url: "/user/logout",
                dataType: "json",
                data: {},
                async: false,
                success: function (data) {
                    if (data["result"] == "ok") {
                        layer.msg('退出成功', {time: 1000}, function () {
                            window.location = "index";
                        });
                    } else if (data["result"] == "fail") {
                        layer.msg('您还没有登录哦~', {time: 1000}, function () {
                            window.location.reload();
                        });
                    }
                },
                type: "post"
            });
        }

        function setDefault(deliveryAddressId) {
            $.ajax({
                url: "/deliveryAddress/setDefault",
                dataType: "json",
                data: {"deliveryAddressId": deliveryAddressId},
                async: false,
                success: function (data) {
                    if (data["result"] == "ok") {
                        layer.msg('设置成功', {time: 800}, function () {
                            window.location.reload();
                        });
                    } else if (data["result"] == "fail") {
                        layer.msg('设置失败', {time: 800}, function () {
                            window.location.reload();
                        });
                    } else if (data["result"] == "noSession") {
                        layer.msg('登录失效，请重新登录', {time: 800}, function () {
                            window.location = "login";
                        });
                    } else {
                        layer.msg('系统错误', {time: 800}, function () {
                            window.location.reload();
                        });
                    }
                },
                type: "post"
            });
        }

        $(document).ready(function () {
            $("#more").click(function () {
                $("#more1").show();
                $("#more2").show();
                $("#more").hide();
            });
        });
        (function (a) {
            a.fn.hoverClass = function (b) {
                var a = this;
                a.each(function (c) {
                    a.eq(c).hover(function () {
                        $(this).addClass(b)
                    }, function () {
                        $(this).removeClass(b)
                    })
                });
                return a
            };
        })(jQuery);

        $(function () {
            $("#pc-nav").hoverClass("current");
        });


        $(document).ready(function ($) {

            $(".btn1").click(function (event) {
                $(".hint").css({"display": "block"});
                $(".box").css({"display": "block"});
            });

            $(".hint-in3").click(function (event) {
                $(".hint").css({"display": "none"});
                $(".box").css({"display": "none"});
            });

            $(".hint3").click(function (event) {
                $(this).parent().parent().css({"display": "none"});
                $(".box").css({"display": "none"});
            });

            $("#H-table li").each(function (i) {
                $(this).click((function (k) {
                    var _index = k;
                    return function () {
                        $(this).addClass("cur").siblings().removeClass("cur");
                        $(".H-over").hide();
                        $(".H-over:eq(" + _index + ")").show();
                    }
                })(i));
            });

        });
    </script>
    <script>
        //注意：导航 依赖 element 模块，否则无法进行功能性操作
        layui.use('element', function () {
            var element = layui.element;

            //…
        });
    </script>


</head>
<body>

<!--<div class="box">-->
<!--    <div class="hint">-->
<!--        <div class="hint-in1">-->
<!--            <div class="hint2">添加收货地址</div>-->
<!--            <div class="hint3"></div>-->
<!--        </div>-->


<!--        <div class="pc-label"><label><i class="reds ">*</i>收货人:</label><input type="text" placeholder="请您填写收货人姓名"></div>-->
<!--        <div id="sjld" style="margin-top:10px; padding-left:40px; position:relative;" class="clearfix">-->

<!--            <div class="clearfix" style="padding-bottom:5px;"><i class="reds fl">*</i><p class="fl">所在地区:</p></div>-->

<!--            <div class="m_zlxg" id="shenfen">-->

<!--                <p title="">选择省份</p>-->
<!--                <div class="m_zlxg2">-->
<!--                    <ul></ul>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="m_zlxg" id="chengshi">-->
<!--                <p title="">选择城市</p>-->
<!--                <div class="m_zlxg2">-->
<!--                    <ul></ul>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="m_zlxg" id="quyu">-->
<!--                <p title="">选择区域</p>-->
<!--                <div class="m_zlxg2">-->
<!--                    <ul></ul>-->
<!--                </div>-->
<!--            </div>-->
<!--            <input id="sfdq_num" type="hidden" value="" />-->
<!--            <input id="csdq_num" type="hidden" value="" />-->
<!--            <input id="sfdq_tj" type="hidden" value="" />-->
<!--            <input id="csdq_tj" type="hidden" value="" />-->
<!--            <input id="qydq_tj" type="hidden" value="" />-->
<!--        </div>-->

<!--        <div class="pc-label"><label><i class="reds ">*</i>详细地址:</label><input type="text" style="width:400px; " placeholder="请您填写收货人详细地址"></div>-->
<!--        <div class="pc-label"><label><i class="reds ">*</i>手机号码:</label><input type="text" style="width:400px;"placeholder="请您填写收货人手机号码"></div>-->
<!--        <div class="pc-label"><label>邮箱:</label><input type="text" style="width:400px;" placeholder="请您填写邮箱地址"></div>-->
<!--        <a th:href="@{/javascript:}" class="hint-in3">保存收货地址</a>-->
<!--    </div>-->

<!--</div>-->

 <input type="hidden" id="cartIdNull" th:value="${session.cartIsNull}">
<!--- header begin-->
<header id="pc-header">
    <div class="BHeader">
        <div class="yNavIndex">
            <ul class="BHeaderl">
                <li><a th:if="${session.userId}==null" th:href="@{/login}">请登录</a></li>
                <li class="headerul" th:if="${session.userId}==null">|</li>
                <li><a th:if="${session.userId}==null" th:href="@{/register}">免费注册</a></li>
                <li class="headerul" th:if="${session.userId}==null">|</li>
                <li><a th:href="@{/myOrder?pageNum=1&pageSize=5}" th:if="${session.userId}!=null">我的订单</a></li>
                <li class="headerul" th:if="${session.userId}!=null">|</li>
                <li><a th:href="@{/myCollect?pageNum=1&pageSize=8}" th:if="${session.userId}!=null">我的收藏</a></li>
                <li class="headerul" th:if="${session.userId}!=null">|</li>
                <li id="pc-nav" class="menu" th:if="${session.userId}!=null"><a th:href="@{#}" class="tit">我的淘淘</a>
                    <div class="subnav">
                        <a th:href="@{/accountSecurity}">账户安全</a>
                        <a th:href="@{/myAddress}">地址管理</a>
                        <a th:href="@{/myEvaluate?pageNum=1&pageSize=5}">我的评价</a> <a th:href="@{/viewHistory?pageNum=1&pageSize=5}">浏览记录</a>
                    </div>
                </li>
                <li class="headerul" th:if="${session.userId}!=null">|</li>
                <li th:if="${session.userId}!=null">
                    <a th:text="${session.userName}"></a>
                </li>
                <li th:if="${session.userId}!=null">
                    <img th:src="'/myFile/img/userHeadPic/'+${session.userHead}+''"
                         onclick="javascript:window.location='myInfo'" style=" width:30px;height:30px;">
                    <a href="javascript:logout()" style="float: right;">退出</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="container clearfix" style="padding:20px 0 20px ">
        <div class="header-logo fl"><h1><a th:href="@{/index}" style="color:#ea4949;">
            <img th:src="@{/myFile/imgold/icon/logo1.png}" style="width:100px;height:80px;"><strong>淘淘商城</strong></a>
        </h1>
        </div>
        <div class="pc-step-title fl" style="padding:20px;">
            <ul>
                <li class="cur2"><a th:href="@{/#}">1 . 我的购物车</a></li>
                <li class="cur"><a th:href="@{/#}">2 . 填写核对订单</a></li>
                <li><a th:href="@{/#}">3 . 成功提交订单</a></li>
            </ul>
        </div>
    </div>

</header>
<!-- header End -->


<!-- 订单提交成功 begin-->
<section th:if="${SpeComs}!=null">
    <input type="hidden" id="allCheckId" th:value="${allCheckCartId}">
    <input type="hidden" id="orderId" th:value="${orderId}">
    <div class="containers">
        <div class="pc-space">
            <div class="pc-order-title clearfix"><h3 class="fl">收货人信息</h3>
                <a href="javascript:addAddress()" target="_blank"class="fr pc-order-add btn1">新增收货地址</a>
            </div>
            <div class="pc-border">
                <div class="pc-order-text clearfix">
                    <ul class=" clearfix">
                        <li class="clearfix fl" th:each="das : ${deliveryAddresses}" th:if="${das.isdefault}==1"
                            style="width: 90%">
                            <div style="float:left;padding:8px;">
                                <input type="radio" th:id="${das.id}" class="address" name="address" title="address" checked>
                            </div>

                            <!--                           <div class="fl pc-frame pc-frams"> <a th:href="@{/#}">地址一</a></div>-->
                            <div class="fl pc-address" >
                                <label th:for="${das.id}">
                                    <span th:text="${das.receiver}"></span>
                                    <span th:text="${das.phone}"></span>
                                    <span>
                                   <span th:text="${das.province}"></span>
                                   <span th:text="${das.city}"></span>
                                   <span th:text="${das.area}"></span>
                                   <span th:text="${das.address}"></span>
                               </span>
                                </label>

                            </div>
                            <div class="pc-click fr" style="float: right;" >
                                <a th:href="'javascript:setDefault('+${das.id}+')'"
                                   th:if="${das.isdefault}!=1">设为默认地址</a>
                                <a th:if="${das.isdefault}==1">默认地址</a>

                                <a th:href="'javascript:edit('+${das.id}+')'">编辑</a>
                                <a th:href="@{#}" id="more">更多</a>
                            </div>
                        </li>


                    </ul>
                    <ul class=" clearfix">
                        <li class="clearfix fl" th:each="das : ${deliveryAddresses}" th:if="${das.isdefault}!=1"
                            style="display:none;width: 90%" id="more1">
                            <div style="float:left;padding:8px;">
                                <input type="radio" th:id="${das.id}" class="address" name="address" title="address">
                            </div>

                            <!--                           <div class="fl pc-frame pc-frams"> <a th:href="@{/#}">地址一</a></div>-->
                            <div class="fl pc-address">
                                <label th:for="${das.id}">
                                <span th:text="${das.receiver}"></span>
                                <span th:text="${das.phone}"></span>
                                <span>
                                   <span th:text="${das.province}"></span>
                                   <span th:text="${das.city}"></span>
                                   <span th:text="${das.area}"></span>
                                   <span th:text="${das.address}"></span>
                               </span>
                                </label>
                            </div>
                            <div class="pc-click fr" id="more2">
                                <a th:href="'javascript:setDefault('+${das.id}+')'"
                                   th:if="${das.isdefault}!=1">设为默认地址</a>
                                <a th:if="${das.isdefault}==1">默认地址</a>
                                <a th:href="'javascript:edit('+${das.id}+')'">编辑</a>
                            </div>
                        </li>

                        <li class="fr" style="display:none;" id="more2">

                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="pc-space">
            <div class="pc-order-title clearfix"><h3 class="fl">支付方式</h3></div>
            <div class="pc-border">
                <div class="pc-order-text clearfix">
                    <ul class=" clearfix">
                        <li class="clearfix fl">
                            <div class="fl pc-frame pc-frams"><a th:href="@{#}"> 在线支付</a></div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="fl ">
            <div class="pc-order-title clearfix"><h3 class="fl">商品信息</h3></div>
            <div class="pc-border">
                <div class="pc-order-text clearfix">
<!--                    <div class="pc-wares-t"><h4><span>共<b th:text="${size}"></b> 件商品，总商品金额：</span> <em th:text="'￥'+${allSumPrice}+''"></em></h4></div>-->
                    <div class="clearfix pc-wares-p" th:each="scs : ${SpeComs}">
                        <div class="fl pc-wares"><a th:href="'/commodityInfo?commodityId='+${scs.commodityId}+''">
                            <img th:src="'/myFile/img/commodityPic/'+${scs.picLink}+''"
                                 style="width: 82px;height: 82px">
                        </a></div>
                        <div class="fl pc-wares-w">
                            <a th:href="'/commodityInfo?commodityId='+${scs.commodityId}+''">
                                <span th:text="${scs.name}"></span>
                            </a>
                            <p class="clearfix"><span class="fl">规格：<span th:text="${scs.typeName}"></span></span>

                            </p>
                        </div>
                        <div class="fl pc-wares-s">
                               <span class="reds" th:text="'￥'+${scs.price}+''">
                               </span>
                            <span th:text="'X'+${scs.commodityCount}+''"></span>
                            <span th:text="'小计：'+${scs.sumPrice}+''"></span>
                        </div>
                    </div>

                    <div class="pc-written"><p>订单留言</p> <input type="text" class="layui-input"></div>
                </div>
            </div>
        </div>
        <div class="pc-space clearfix fr" style="width: 400px;">
            <div class="pc-order-title clearfix"><h3 class="fl">配送方式</h3></div>
            <div class="pc-order-text pc-order-l clearfix"style="border:1px solid #dddddd;height:190px">
                <ul id="H-table" class="clearfix H-table">
                    <li class="cur">
                        <a th:href="@{javascript:void(0)}">淘淘快递</a>
                    </li>

                </ul>
                <div class="pc-freight"style="margin-top:120px"><hr><p>运费： <span th:text="${allSumFreight}"></span>元</p></div>
            </div>

        </div>
        <div style="position:relative;float:left;width:757px;margin:20px">
            <div class="fl pc-list-t">
                <ul>
                    <li><span>共<b th:text="${size}"></b> 件商品，总商品金额：</span> <em th:text="'￥'+${allSumPrice}+''"></em>
                    </li>
                    <li><span>运费：</span> <em th:text="'￥'+${allSumFreight}+''"></em></li>
                    <li><span>应付总额：</span> <em th:text="'￥'+${allPayPrice}+''"></em></li>
                </ul>
            </div>
        </div>
        <div class="clearfix" >
            <div class="fr pc-space-j"style="margin:20px">
                <spna>应付总额：<strong>￥<span th:text="${allPayPrice}"></span></strong></spna>
                <button class="pc-submit" type="button" onclick="submmitOrder()">提交订单</button>
            </div>
        </div>

    </div>
</section>
<div th:if="${SpeComs}==null" style="height:400px;text-align: center">
    <p style="margin-top:200px;text-align:center;font-size: 18px;">您还没有选择商品哦~</p><br>
    <button type="button" class="layui-btn layui-btn-primary " onclick="window.history.go(-1);"> <i class="layui-icon">&#xe65c;</i>返回</button>

</div>
<div th:if="${error}=='error'" style="height:400px;text-align: center">
    <p style="margin-top:200px;text-align:center;font-size: 18px;">系统错误，请返回重试~</p><br>
    <button type="button" class="layui-btn layui-btn-primary " onclick="window.history.go(-1);"> <i class="layui-icon">&#xe65c;</i>返回</button>

</div>
<!-- 订单提交成功 End-->


<!--- footer begin-->
<div class="aui-footer-bot">
    <div class="time-lists aui-footer-pd clearfix">
        <div class="aui-footer-list clearfix">
            <h4>
                <span><img th:src="@{/myFile/imgold/icon/icon-d1.png}"></span>
                <em>消费者权益</em>
            </h4>
            <ul>
                <li><a th:href="@{/#}">保障范围 </a></li>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>
                <span><img th:src="@{/myFile/imgold/icon/icon-d2.png}"></span>
                <em>新手上路</em>
            </h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>
                <span><img th:src="@{/myFile/imgold/icon/icon-d3.png}"></span>
                <em>保障正品</em>
            </h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>
                <span><img th:src="@{/myFile/imgold/icon/icon-d1.png}"></span>
                <em>消费者权益</em>
            </h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
    </div>
    <div style="border-bottom:1px solid #dedede"></div>
    <div class="time-lists aui-footer-pd time-lists-ls clearfix">
        <div class="aui-footer-list clearfix">
            <h4>购物指南</h4>
            <ul>
                <li><a th:href="@{/#}">保障范围 </a></li>
                <li><a th:href="@{/#}">购物流程</a></li>
                <li><a th:href="@{/#}">会员介绍 </a></li>
                <li><a th:href="@{/#}">生活旅行</a></li>
                <li><a th:href="@{/#}"> 常见问题 </a></li>
                <li><a th:href="@{/#}"> 联系客服购物指南 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>特色服务</h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>帮助中心</h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
        <div class="aui-footer-list clearfix">
            <h4>新手指导</h4>
            <ul>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">退货退款流程</a></li>
                <li><a th:href="@{/#}">服务中心 </a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}">服务中心</a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
                <li><a th:href="@{/#}"> 更多特色服务 </a></li>
            </ul>
        </div>
    </div>
</div>
<!-- footer End -->

<!--<script type="text/javascript" th:src="@{/theme/js/address.js}"></script>-->
<!--<script type="text/javascript">-->
<!--    // $(function(){-->
<!--    //-->
<!--    //     $("#sjld").sjld("#shenfen","#chengshi","#quyu");-->
<!--    //-->
<!--    // });-->
<!--</script>-->
</body>
</html>